home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Almathera Ten Pack 3: CDPD 3
/
Almathera Ten on Ten - Disc 3: CDPD3.iso
/
scope
/
001-025
/
scopedisk8
/
superlib
/
libsrc.arc
/
bmov.asm
< prev
next >
Wrap
Assembly Source File
|
1987-12-22
|
1KB
|
64 lines
;BMOV.ASM
; 4 812
;BMOV(src,dest,bytes)
;
; Matthew Dillon
;
; -Handles ascending/descending moves
; -Optimizes the move if addresses longword boundries and #bytes
; is a multiple of 4.
; -Completely tested
xdef _bmov
_bmov
movem.l 4(A7),A0/A1;source, destination
move.l12(A7),D0;bytes
clr.bD1;long word boundry flag
andi.b#3,15(A7);byte count multiple of 4?
bnenotlwb
andi.b#3,7(A7);source mulitple of 4?
bnenotlwb
andi.b#3,11(A7);destination multiple of 4?
seq.bD1;set longword boundry flag if true
notlwbcmp.lA0,A1
beqend;trivial case
bleascend;ascending copy
add.lD0,A0;descending copy
add.lD0,A1
decendtst.bD1;DESCEND
beqdecbyte
declong lsr.l#2,D0;DESCEND LONGWORD
braab00
ab0move.l-(A0),-(A1)
ab00dbf.wD0,ab0
sub.l#$10000,D0
bplab0
endrts
ab1move.b-(A0),-(A1);DESCEND BYTE
decbyte dbf.wD0,ab1
sub.l#$10000,D0
bplab1
rts
ascendtst.bD1;ASCEND
beqascbyte
asclong lsr.l#2,D0;ASCEND LONGWORD
braab22
ab2move.l(A0)+,(A1)+
ab22dbf.wD0,ab2
sub.l#$10000,D0
bplab2
rts
ab3move.b(A0)+,(A1)+;ASCEND BYTE
ascbyte dbf.wD0,ab3
sub.l#$10000,D0
bplab3
rts